home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
program
/
245
/
mag3
/
read.me
< prev
Wrap
Text File
|
1988-10-10
|
6KB
|
129 lines
Some comments on BLIT.PRG, MAG1.PRG, and MAG2.BAS
designed by Thomas H. Likens
6/25/88
These three programs are examples of how to combine GFA
Basic programs with machine language.
>>>>>> IMPORTANT!!!... ACCOLADES DEPT. <<<<<<<<<
_________________________________________________________________
None of these programs would have been possible without
the excellent material provided by Frank Ostrowski (the
author of GFA Basic) in his tutorial the GFA Basic Book.
I wanted to test the interfacing of machine language with
GFA Basic, for the purpose of creating a medium resolution
magnifying routine. To successfully accomplish this I needed
an interesting visual pattern to magnify. Frank Ostrowski's
book provided an exellent design, simple to create and yet
visually exciting, using the XOR logical operator. I
incorporated this design, with minimal changes, into my
programs and believe that credit should be given where
credit is due. If you want to program in GFA Basic
Frank Ostrowski's book is a 'must have' item!!!
_____________________________________________________________________
Now onward...
Essentially, these programs use the GFA Get command to obtain
a bitmap approximately 64 pixels wide x 50 pixels tall.
Then the starting address of the Get string is obtained by
the Varptr command (along with certain other documented
parameters) and passed to a machine language program. The
machine language program is stored as data statements in the GFA
program so that the maximum possible speed could be achieved.
The main problem I had, ironically enough, was accessing the
data stored by the Get command. The actual data starts after
you add 6(six) to the address returned by the Varptr command.
Fair enough this is documented so I expected it. What I could
not find documented (at least clearly enough to understand) is
that after every 16 bytes stored by the Get command it then
stores 4 null bytes. I spend over two hours chasing down this
little tidbit of information. Oh well, such are the
fortunes of war. Anyway I hope this saves you some time if you
ever use the Get command in a similar fashion.
The first program is a custom blitter routine to augment
the GFA PUT Command. The machine language source code is
included under the name Blit.S. If you look closely at the GFA routine, you will notice a slight distortion of the image.
The machine language routine eliminates this distortion.
I converted the machine language routine into data statements
using a variation of a program included by Frank Ostrowski on
pp. 95-96 of his GFA Basic Book. When using this program pay
special attention to whether you assemble your programs PC-Relative
or relocatable.
I passed the parameters to the assembly language routine
through the GFA command Void C:prg_address%(). Even though
this command was intended to run compiled C programs from GFA I found
it easier to work with then the Call command. The way the stack
accepts these variables is as follows:
EXAMPLE 1: Void C:prg_address%(45,99,82,212)
The STACK...
|________________|
|________________|
|______ 1 _______|
|______212_______|
|_______82_______|
|_______99_______|
|_______45_______|
?>|_____Random__#__| I'm not sure what this is.
|______ 1 _______| < Stack Pointer
EXAMPLE 2: Void C:prg_address%(L:45,L:99,L:82,58,212)
NOTE: The 'L:' in front of the number means that you are
passing a longword (32 bits) to the assembly program. The default
setting for passing parameters is a word (16 bits).
The STACK...
|________________|
|______ 1 _______|
|______212_______|
|_______58_______|
|_______82_______|
|________0_______|
|_______99_______|
|________0_______|
|_______45_______|
|________0_______|
?>|____Random_#____|
|______ 1 _______| < Stack Pointer
The second and third programs are medium resolution magnifying
routines. Since bit manipulation can be accomplished much more
readily in assembly than any high level language, the actual
magnifying of the image was done with machine language and
combined with GFA. The program MAG1 is basically a driver
program. It is very similar to the Blitter program. Mag2 is
slightly more sophisticated employing the technique of page flipping
to give the animation a smoother look. I would have compiled MAG2
also but I am using an older version of the GFA Compiler
and I cannot get it to compile correctly. The compiled program wants
to change to low resolution once the Xbios(5) [Set_screen] call
is made. I suspect it is substituting something else besides -1
into the resolution parameter. Therefore you will need GFA Basic or
its Run-only module to use this program.
The unarced file should contain:
BLIT.BAS > GFA source code
BLIT.PRG > Compiled GFA Blitter
BLIT.S > The machine language source code
for the Blitter routine
MAG1.BAS > GFA source code
MAG1.PRG > Compiled prg.
MAG2.BAS > GFA MAG2 source code
MAGNIFY.S > This is the assembly source code for the
magnify routine. It is fully commented.
Both MAG1 and MAG2 use this program.
READ.ME > This documentation file.
I hope these programs and routine are helpful, enjoy!!!